<?php


 $result=['苹果','蓝莓',"李子"];
 $color=[
    'Red'=>false,
    'Green'=>false,
    'Blue'=>false,
 ];
 foreach ($result as $key=>$value) {
    match($value){
        '苹果'=>[
            $colors["Red"]=true,
            $colors["Green"]=true,
        ],
        '蓝莓'=>[
            $colors['Blue']=true,
        ],
        default => null,
    };
}
var_export($colors);